//打印金字塔
var num = 18;
for(var h = 0; h<num; h++){
    var nb = num-h-1;
    for(var i = 0; i<nb; i++){
        document.write("&nbsp;");
    }
    var star = (h+1)*2-1;
    for(var j = 0; j<star; j++){
        document.write("*");
    }
    document.write("<br>");
}